#include "student.h"

int main(int argc, char *argv[])
{

    struct prime_class *class_p;
    class_p = (struct prime_class *)malloc(sizeof(struct prime_class));

    class_p->stu_num = 0;
    
    printf("**************************\n");
    printf("* 欢迎使用学生管理小程序 *\n");
    printf("**************************\n");

    while (1)
    {
        int input;
        printf("**************************\n");
        printf("*  1.ADD 2.DEL 3.UPDATE  *\n");
        printf("*  4.LIST 5.SORT 6.QUIT  *\n");
        printf("**************************\n");
        printf("> ");
        scanf("%d", &input);

        switch (input) {
            case ADD:
                add(class_p);

                break;
            case DEL:
                del(class_p);
                
                break;
            case UPDATE:
                update(class_p);

                break;
            case LIST:
                list(class_p);

                break;
            case SORT:
                sort(class_p);
                
                break;
            case QUIT:
                printf("感谢使用!\n");
                return 0;
                break;
            default:
                printf("输入错误， 请重新输入\n");
                scanf("%d", &input);
                break;
        }

        getchar();
    }

    if (class_p != NULL) {
        free(class_p);
        class_p = NULL;
    }

    return 0;
}
